package com.zlsy.thread.synchronizedlearing;

/**
 * @author zhouliang
 * @date 2020/03/19
 * <p>
 * 可重复不要求是同一个类中
 **/
public class SynchronizedReentrantTest3 {

    public synchronized void doSomething() {
        System.out.println("我是父类的方法");
    }

}

class TestClass extends SynchronizedReentrantTest3 {
    @Override
    public synchronized void doSomething() {
        System.out.println("我是子类的方法");
        super.doSomething();
    }

    public static void main(String[] args) {
        TestClass testClass = new TestClass();
        testClass.doSomething();
    }
}
